<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>aa</title>
</head>
<body>
<iframe src="http://localhost:2000/b.html" frameborder="0" id="frame" onload="load()"></iframe>
<script>
    function load(){
        let frame=document.getElementById('frame');
        frame.contentWindow.postMessage('a页面','http://localhost:2000')
    }
</script>
</body>
</html>